package cn.edu.ctgu.geo.type;

import lombok.Data;

    /**
     * 计算结果封装类（根据经纬度范围计算出来立方体的信息）
     */
    @Data
    public  class CalculationResult {
        private  double longitudeDistance;  // 经度方向距离(米)
        private  double latitudeDistance;   // 纬度方向距离(米)
        private  double cubeSideLength;     // 正方体米边长()
        private  double minHeight;          // 最小高度(米)
        private  double maxHeight;          // 最大高度(米)
        
        public CalculationResult(double longitudeDistance, double latitudeDistance, 
                                double cubeSideLength, double minHeight, double maxHeight) {
            this.longitudeDistance = longitudeDistance;
            this.latitudeDistance = latitudeDistance;
            this.cubeSideLength = cubeSideLength;
            this.minHeight = minHeight;
            this.maxHeight = maxHeight;
        }
        
        @Override
        public String toString() {
            // 使用StringBuilder避免字符串拼接效率问题
            String sb = "=== 正方体维度计算结果 ===\n" +
                    String.format("1. 经度方向距离: %.2f米\n", longitudeDistance) +
                    String.format("2. 纬度方向距离: %.2f米\n", latitudeDistance) +
                    String.format("3. 正方体边长(取最小值): %.2f米\n", cubeSideLength) +
                    "4. 推荐高度范围:\n" +
                    String.format("   - 方案1(地面以上): [%.2f米, %.2f米]\n", minHeight, maxHeight) +
                    String.format("   - 方案2(中心在地面): [%.2f米, %.2f米]\n",
                            -cubeSideLength / 2, cubeSideLength / 2) +
                    "=======================";
            return sb;
        }
    }